package com.example.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author 游家纨绔
 * @dateTime 2023-09-09 23:30
 * @apiNote TODO 支付宝配置类
 */
@Data
@Component
@ConfigurationProperties(prefix = "alipay")
public class AlipayConfig {

	private String appId;

	// TODO 配置文件中的属性有带下划线的，转到我们Java属性要写成驼峰格式
	private String alipayPublicKey;

	private String merchantPrivateKey;

	private String notifyUrl;

	private String returnUrl;

	private String signType;

	private String charset;

	private String gatewayUrl;

	private String logPath;

	// 定义一个方法返回AlipayConfig 对象
	public AlipayConfig getAlipayConfig() {
		AlipayConfig alipayConfig = new AlipayConfig();
		alipayConfig.setAppId(appId);
		alipayConfig.setAlipayPublicKey(alipayPublicKey);
		alipayConfig.setMerchantPrivateKey(merchantPrivateKey);
		alipayConfig.setNotifyUrl(notifyUrl);
		alipayConfig.setReturnUrl(returnUrl);
		alipayConfig.setSignType(signType);
		alipayConfig.setCharset(charset);
		alipayConfig.setGatewayUrl(gatewayUrl);
		alipayConfig.setLogPath(logPath);
		return alipayConfig;
	}

}
